using MicroMsg.Common.Event;
using MicroMsg.UI.Util;
using Microsoft.Phone.Controls;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
namespace MicroMsg.Source.UI.Util
{
	public class CommmonWebView : BasePage
	{
		private const string TAG = "CommmonWebView";
		private string strUrl;
		private string strTitle;
		private string strUserName;
		private string strWeiBoUserName;
		private EventWatcher mWatcherGetUrl;
		private bool isLoadComplete;
		internal Grid LayoutRoot;
		internal WebBrowser mWebBrower;
		internal PerformanceProgressBar ProgressBar;
		private bool _contentLoaded;
		public CommmonWebView()
		{
			this.InitializeComponent();
		}
		protected override void OnPageIn(object[] object_0)
		{
			if (object_0 != null && object_0.Length == 3)
			{
				this.strUrl = (string)object_0[0];
				this.strUserName = (string)object_0[1];
				this.strWeiBoUserName = (string)object_0[2];
				if (this.strWeiBoUserName.StartsWith("@"))
				{
					this.strWeiBoUserName = this.strWeiBoUserName.Substring(1, this.strWeiBoUserName.get_Length() - 1);
				}
				this.navigateToUrl(this.strUrl);
			}
		}
		private void navigateToUrl(string string_0)
		{
			Uri uri;
			if (!string.IsNullOrEmpty(string_0))
			{
				uri = new Uri(string_0);
			}
			else
			{
				uri = new Uri(this.strUrl);
			}
			this.mWebBrower.Navigate(uri);
		}
		private void web_Navigated(object sender, NavigationEventArgs e)
		{
			string originalString = e.get_Uri().get_OriginalString();
			if (!originalString.Contains(this.strUrl))
			{
				return;
			}
			this.ProgressBar.IsIndeterminate = true;
		}
		private void web_loadedComplete(object sender, NavigationEventArgs e)
		{
			this.isLoadComplete = true;
			if (this.ProgressBar.IsIndeterminate)
			{
				this.ProgressBar.IsIndeterminate = false;
			}
		}
		private void web_scriptNotify(object sender, NotifyEventArgs e)
		{
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/Util/CommmonWebView.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.mWebBrower = (WebBrowser)base.FindName("mWebBrower");
			this.ProgressBar = (PerformanceProgressBar)base.FindName("ProgressBar");
		}
	}
}
